<html>
<head>
 <title>Monochromatic triangles</title>
</head>

<body>

<center>
<h1>POI IV Stage III Problem 5</h1>
<h1>Monochromatic triangles</h1>
</center>

<p>
There are n points given in a space. There are no three points, such that they lie
on the same straight line. Each pair of points is connected by a segment coloured
red or black. Each triangle, whose sides have the same colour is called a
<b>monochromatic triangle</b>. We are given a list of all red segments and we
want to find the number of all monochromatic triangles.

<p>
<h2>Task</h2>
Write a program that:
<ul>
<li>reads from the text file TRO.IN the following data: 
the number of points, the number of red segments and their list,
<li>finds the number of monochromatic triangles,
<li>writes the result to the text file TRO.OUT.
</ul>
</p>
 
<p>
<h2>Input</h2>
In the first line of the text file TRO.IN there is one integer n,
3 &lt;= n &lt;= 1000, which equals the number of points.</p>

<p>In the second line of the same file there is one integer m,
0 &lt;= m &lt;= 250000, which equals the number of red segments.</p>

<p>In each of the following m lines there are two integers p and k separated by
a single space, 1 &lt;= p <  k &lt;= n. They are numbers of vertices which are ends of 
a red segment.
</p>
 
<p>
<h2>Output</h2>
In the first line of the text file TRO.OUT there should be written one integer -
the number of monochromatic triangles.
</p>
 
<p>
<h2>Example</h2>
For the text file TRO.IN:
<pre>6 
9
1 2
2 3
2 5
1 4
1 6
3 4
4 5
5 6
3 6</pre>
the correct solution is the text file TRO.OUT
<pre>2</pre>
</p>
 
</body>

</html>
